package classload;

public class User {
    public User() {
    }

    private Integer age = 10;
    private String name = "OOM";

    public Integer getAge() {
        return age;
    }

    public User(Integer age, String name) {
        this.age = age;
        this.name = name;
    }

    @Override
    protected void finalize() throws Throwable {
        System.out.println(toString() + " 被标记了");
        FInalizeTest.list.add(this);
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void sout() {
        System.out.println("User");
    }

    @Override
    public String toString() {
        return "User{" +
                "age=" + age +
                ", name='" + name + '\'' +
                '}';
    }
}
